<?php

	$desImage = file_get_contents("share.jpg");
	$srcImage = file_get_contents("smile.png");
	$des = imagecreatefromstring($desImage);
	$src = imagecreatefromstring($srcImage);

	$des_width = imagesx($des);
	$des_height = imagesy($des);

	$src_width = imagesx($src);
	$src_height = imagesy($src);

	$des_x_from = ($des_width - $src_width/2) / 2;
	$des_y_from = ($des_height - $src_height/2) / 2;


	imagecopyresampled($des, $src, $des_x_from, $des_y_from, 0, 0, $src_width/2, $src_height/2, $src_width, $src_height);
	imagepng($des, "/tmp/test1.png");
	imagedestroy($des);
?>
